package com.asset.dispoal.address.service.commom;

import com.asset.dispoal.address.domain.db.entity.SysAddressDo;
import com.asset.dispoal.address.domain.db.mapper.SysAddressMapper;
import com.asset.dispoal.address.dto.SysAddressRequest;
import com.asset.dispoal.address.service.converter.AddressConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/2/16$
 */
@Component
public class AddressUpdateCommand implements BaseCommand<SysAddressRequest, Result> {

    @Autowired
    SysAddressMapper sysAddressMapper;

    @Override
    public Result execute(SysAddressRequest request) {
        final SysAddressDo sysAddressDo = AddressConverter.INSTANCE.reqToDo(request);
        sysAddressMapper.update(sysAddressDo);
        return Result.ok();
    }
}
